using System.Collections;
using Rewired;
using UnityEngine;

public class InputController : Singleton<InputController>
{
	private Player player;

	public Vector3 moveVector;

	public bool action;

	private Coroutine _coroutine;

	public Vector3 MoveVector => new Vector3(player.GetAxis(0), player.GetAxis(1), 0f);

	public float Horizontal => player.GetAxis(0);

	public float Vertical => player.GetAxis(1);

	public bool Action => player.GetButtonDown(2);

	public bool Back => player.GetButtonDown(3);

	public bool Left => player.GetButtonDown(4);

	public bool LeftPressed => player.GetButton(4);

	public bool Right => player.GetButtonDown(5);

	public bool RightPressed => player.GetButton(5);

	public bool Up => player.GetButtonDown(6);

	public bool UpPressed => player.GetButton(6);

	public bool Down => player.GetButtonDown(7);

	public bool DownPressed => player.GetButton(7);

	public bool Y => player.GetButtonDown(8);

	public bool X => player.GetButtonDown(9);

	public bool RTrigger => player.GetButtonDown(10);

	public bool LTrigger => player.GetButtonDown(11);

	public bool Plus => player.GetButtonDown(12);

	private new void Awake()
	{
		player = ReInput.players.GetPlayer(0);
		ReInput.ControllerDisconnectedEvent += OnControllerDisconnected;
	}

	private void Start()
	{
		CallApplet();
	}

	private void OnDestroy()
	{
		ReInput.ControllerDisconnectedEvent -= OnControllerDisconnected;
	}

	private void OnControllerDisconnected(ControllerStatusChangedEventArgs controllerStatus)
	{
	}

	private void CallApplet()
	{
		if (ReInput.players.GetPlayer(0).controllers.joystickCount <= 0 && _coroutine == null)
		{
			_coroutine = StartCoroutine(CallAppletRoutine());
		}
	}

	private IEnumerator CallAppletRoutine()
	{
		yield return new WaitForSeconds(0.1f);
		yield return new WaitForSeconds(0.1f);
		_coroutine = null;
	}

	private bool CallControllerApplet(int minPlayers, int maxPlayers)
	{
		return true;
	}
}
